Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS-7349 [Staking] Send input token and public key in several requests #3666

Merged
merged 6 commits into from
Aug 15, 2024

Conversation

fedorov-d
Copy link
Contributor

@fedorov-d fedorov-d commented Aug 15, 2024

Добавил параметры inputToken и publicKey в запросы на action и estimate gas, оказались обязательными для cosmos.
Пр по космосу в бсдк:

@@ -64,13 +64,17 @@ struct CommonWalletModelsFactory {
)
}

func makeStakingManager(tokenItem: TokenItem, address: String) -> StakingManager? {
func makeStakingManager(publicKey: Data, tokenItem: TokenItem, address: String) -> StakingManager? {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publicKey кладется в additionalAddresses -> cosmosPubKey

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вынес в отдельный файл

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в интерфейсах запросов стало слишком много параметров, вынес в отдельную сущность

@@ -9,15 +9,15 @@
import Foundation

public struct StakingBalanceInfo: Hashable {
public let item: StakingTokenItem
public let item: StakingToken
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

разбил сущность StakingTokenItem на StakingToken (парсится из yield модельки) и StakingTokenItem (может быть создан локально, например в TokenItem+StakingTokenItem.swift), а то была путаница

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А вот думаю надо ли? По факту мы спокойно можем создать StakingToken из TokenItem в TokenItem+StakingTokenItem.swiftда и все

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай попробую переделать, если что - отпишу

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вроде получилось

guard let network = StakeKitNetworkType(rawValue: token.network) else {
throw StakeKitMapperError.noData("StakeKitNetworkType not found")
}

return StakingTokenItem(network: network, contractAddress: token.address)
return StakingToken(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

парсим всю модельку чтобы отправить в estimate-gas или exit/enter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я думаю да, давай одну модельку оставим, просто добавим полей
в ней же их нет, просто потому что я их поленился добавлять

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я так сделал сначала но потом запнулся на TokenItem+StakingTokenItem.swift, там не понятно как создавать

func additionalAddresses() -> AdditionalAddresses? {
switch wallet.item.network {
case .cosmos:
guard let publicKey = wallet.publicKey,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно конвертнуть в base64

@fedorov-d fedorov-d marked this pull request as ready for review August 15, 2024 07:23
@fedorov-d fedorov-d requested review from tureck1y and a team as code owners August 15, 2024 07:23
Comment on lines +263 to +268
network: tokenItem.network.rawValue,
name: tokenItem.name,
decimals: tokenItem.decimals,
address: tokenItem.contractAddress,
symbol: tokenItem.symbol,
logoURI: nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А stake kit прям все параметры нужны? Может там без name и без decimals можно?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

наверное можно, но андроид все шлет, я бы оставил пока все сети не заинтегрим.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

окей)


public init(item: StakingTokenItem, address: String) {
public init(item: StakingTokenItem, address: String, publicKey: Data? = nil) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Давай может без опционала, пускай обязательным будет, мало ли забудем потом где-то

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

убрал

validator: String,
integrationId: String
) async throws -> Decimal {
func estimateStakeFee(params: StakingActionRequestParams) async throws -> Decimal {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У нас тут конфликты будут конечно, но я думаю мой пулл после будет, подолью

Comment on lines +68 to +70
StakingTokenItem(network: .solana, contractAddress: nil, name: "Solana", decimals: 9, symbol: "SOL"),
StakingTokenItem(network: .cosmos, contractAddress: nil, name: "Cosmos", decimals: 6, symbol: "ATOM"),
StakingTokenItem(network: .ethereum, contractAddress: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", name: "Ethereum", decimals: 18, symbol: "ETH"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

блин, тут конечно не очень красиво получилось, ну ок

@fedorov-d fedorov-d merged commit 720f7eb into develop Aug 15, 2024
3 checks passed
@fedorov-d fedorov-d deleted the feature/staking/IOS-7349_cosmos_staking branch August 15, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants